package com.qiaofang.housewarehouse.service.compose;

import com.qiaofang.housewarehouse.dao.domain.HswhCityDistric;
import com.qiaofang.housewarehouse.dao.domain.HswhCityRegion;
import com.qiaofang.housewarehouse.dao.domain.IndexCityRegion;
import com.qiaofang.housewarehouse.dao.domain.IndexCityRegionDistrict;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;

public class CityQueryCompose {
    public static List<String> composeRegionList(List<IndexCityRegion> list){
        List<String> dtoList=new ArrayList<>();
        if(CollectionUtils.isEmpty(list)){
            return dtoList;
        }
        for(IndexCityRegion DO:list){
            if (StringUtils.isNotBlank(DO.getName())) {
                dtoList.add(DO.getName());
            }
        }
        return dtoList;
    }
    public static List<String> composeDistricList(List<IndexCityRegionDistrict> list){
        List<String> dtoList=new ArrayList<>();
        if(CollectionUtils.isEmpty(list)){
            return dtoList;
        }
        for(IndexCityRegionDistrict DO:list){
            if (StringUtils.isNotBlank(DO.getName())) {
                dtoList.add(DO.getName());
            }
        }
        return dtoList;
    }
}
